package com.hyy.backend.service.impl;

import com.hyy.backend.dao.KnowledgeMapper;
import com.hyy.backend.entity.Knowledge;
import com.hyy.backend.service.KnowledgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class KnowledgeServiceImpl implements KnowledgeService {
    @Autowired
    private KnowledgeMapper knowledgeMapper;

    @Override
    public boolean publishKnowledge(Knowledge knowledge) {
        return knowledgeMapper.insertKnowledge(knowledge) > 0;
    }

    @Override
    public List<Knowledge> getUserKnowledge(Integer userId) {
        return knowledgeMapper.getKnowledgeByUserId(userId);
    }

}
